
#ifndef _SPECIALIZATION_HPP_
#define _SPECIALIZATION_HPP_

#include <iostream>
#include <string>

// 类模板
template <class T1, class T2>
class Test
{
  public:
    Test(T1 t1, T2 t2) : a(t1), b(t2) { std::cout << "模板类\n"; }

  private:
    T1 a;
    T2 b;
};

// 全特化
template <>
class Test<int, std::string>
{
  public:
    Test(int i, std::string str) : a(i), b(str) { std::cout << "全特化\n"; }

  private:
    int a;
    std::string b;
};

// 偏特化
template <class T2>
class Test<int, T2>
{
  public:
    Test(int i, T2 t2) : a(i), b(t2) { std::cout << "偏特化\n"; }

  private:
    int a;
    T2 b;
};

#endif